
/*
{
"状态":1,
"名称":"新增-款图片地址",
"作者":"",
"创建时间":"2018-12-25",
"功能":"新增-款图片地址",
"log": [
	{"date":"" , "dev" :"" , "content" : ""}
]
}
*/


DECLARE @styleno varchar(100)
DECLARE @colorid varchar(10)
DECLARE @url varchar(100)
DECLARE @create_user int

Set @styleno='{styleno}'
Set @colorid='{colorid}'
Set @url='{url}'
Set @create_user='{user_key}'

if isnull(@styleno,'')=''
begin
	RAISERROR ('款号不允许为空', 16 ,1 ) ; 
	return
end

if isnull(@colorid,'')=''
begin
	RAISERROR ('颜色不允许为空', 16 ,1 ) ; 
	return
end

if isnull(@url,'')=''
begin
	RAISERROR ('图片地址不允许为空', 16 ,1 ) ; 
	return
end

if exists(select 1 from r_style_pic where styleno=@styleno and colorid=@colorid)
begin
	RAISERROR ('款色已经存在', 16 ,1 ) ; 
	return
end 

INSERT INTO [r_style_pic](styleno,colorid,url,create_user,create_time) VALUES(@styleno,@colorid,@url,@create_user,getdate())